/**
 * 
 */
package com.school.lab.common.utils;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.FilterDispatcher;

/**
 * 
 * @author Tim
 * 
 */
public class DefaultFilterDispatcher extends FilterDispatcher {
	
	/**
	 * Wrap and return the given request, if needed, so as to to transparently
	 * handle multipart data as a wrapped class around the given request.
	 * 
	 * @param request
	 *            Our ServletRequest object
	 * @param response
	 *            Our ServerResponse object
	 * @return Wrapped HttpServletRequest object
	 * @throws ServletException
	 *             on any error
	 */
	protected HttpServletRequest prepareDispatcherAndWrapRequest(
			HttpServletRequest request, HttpServletResponse response)
			throws ServletException {
		HttpServletRequest req = super.prepareDispatcherAndWrapRequest(request,
				response);
		request.setAttribute("__struts_request_wrapper", req);		
		response.setHeader("Pragma","No-cache");    
		response.setHeader("Cache-Control","no-cache");    
		response.setDateHeader("Expires", 0);		
		
		return req;
	}
}
